package com.flame.schedule.service;

import java.util.List;

import com.flame.core.id.IdWorker;
import com.flame.schedule.controller.vo.JobLogVo;
import com.flame.schedule.entity.JobLog;
import com.flame.schedule.mapper.JobLogMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * flame_schedule_job_log 任务信息表
 *
 * @author 吴欣童
 * @since 2022-12-04 12:47:08
 */
@Service
public class JobLogService {

    @Autowired
    private JobLogMapper jobLogMapper;

    @Autowired
    private IdWorker idWorker;

    public List<JobLog> pageJobLog(JobLogVo jobLogVo) {
        return jobLogMapper.page(jobLogVo);
    }

    public void addJobLog(JobLog jobLog) {
        jobLog.setJobLogId(idWorker.nextId());
        jobLogMapper.insert(jobLog);
    }

    public void deleteJobLog(JobLog jobLog) {
        jobLogMapper.deleteById(jobLog.getJobLogId());
    }

    public void batchDelete(List<Long> logIdList) {
        jobLogMapper.batchDelete(logIdList);
    }

    public void clear() {
        jobLogMapper.clear();
    }
}
